package com.example.javaee.dao;


import com.example.javaee.domain.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface CommentMapper {
    //添加一个评论
    Boolean saveComment(Comment comment);
    //查询父级评论
    List<Comment> findByParentIdNull(@Param("ParentId") Long ParentId,Long courseNumber);
    //查询一级回复
    List<Comment> findByParentIdNotNull(@Param("id") Long id);
    //查询二级以及所有子集回复
    List<Comment> findByReplayId(@Param("childId") Long childId);

    //按userId查询用户评论
    List<Comment> findByUserId(@Param("userId") Integer userId);


    List<Comment> adminFindByCourseNumber(@Param("courseNumber") Long courseNumber);

    List<Comment> findByCourseCommentId(Long courseCommentId);
    Comment findById(@Param("id") Long id);
    Boolean addLikeCount(@Param("id") Long id);
    Boolean addDislikeCount(@Param("id") Long id);

    Boolean updateLikeCount(@Param("id") Long id, @Param("likeCount") Long likeCount);
    Boolean updateDislikeCount(@Param("id") Long id, @Param("dislikeCount") Long dislikeCount);
    Boolean deleteById(@Param("id")Long id);
    Boolean deleteChildren(@Param("id")Long id);
    Boolean deleteSubComments(@Param("id")Long id);
}
